package com.gitee.wsl.platform.thread

import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.UnsafeNumber
import platform.posix.pthread_t
import platform.posix.sched_yield
import kotlin.math.max

@OptIn(ExperimentalForeignApi::class)
internal data class NativeThreadHandle(
    val value: pthread_t
) : ThreadHandle

@OptIn(ExperimentalForeignApi::class)
internal actual fun yieldThread() {
    sched_yield()
}

expect val threadCount: Int
    //get() = max(2, sysconf(_SC_NPROCESSORS_ONLN).toInt())